#ifndef __YCWL_H
#define __YCWL_H

#undef max
#undef min

#define LED 26
#define BEEP 12
#define RELAY1 21
#define RELAY2 22
#define SERVO1 32
#define SERVO2 25
#define KEY 27
#define DHT11_PIN 5
#define DHTTYPE DHT11
#define RAIN_AO 35
#define RAIN_DO 32
#define FIRE_AO 39
#define FIRE_DO 19
#define SMOG_AO 34
#define SMOG_DO 25
#define BODY 23
#define SOUND_AO 33
#define SOUND_DO 18

/**
 **oled function
**/
//oled initialization
void oled_init();
void oled_clear();
void oled_display();
void oled_drawString(int16_t x, int16_t y, String text);
//可选字符 ArialMT_Plain_10 ArialMT_Plain_10 ArialMT_Plain_10
void oled_setfont(uint8_t num);
void oled_drawProgressBar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t progress);
void oled_fillRect(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t progress);
void oled_drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1);
void oled_drawRect(int16_t x, int16_t y, int16_t width, int16_t height);
void oled_drawHorizontalLine(int16_t x, int16_t y, int16_t length);
void oled_drawCircle(int16_t x, int16_t y, int16_t radius);
void oled_fillCircle(int16_t x, int16_t y, int16_t radius);
void oled_setPixel(int16_t x, int16_t y);
void oled_invertDisplay();

/**
 **led function
**/
//led initialization
void led_init();
//led open
void led_on();
//led open
void led_off();

/**
 **beep function
**/
//beep initialization
void beep_init();
//beep open
void beep_on();
//beep close
void beep_off();
/**
 **relay function
**/
//relay initialization
void relay_init();
//relay open
void relay_on(uint pin);
//relay close
void relay_off(uint pin);
/**
 **servo function
**/
//servo initialization
void servo_init(uint8_t pin);
//servo control
void servo_pos(int pin, int pos);
/**
 **servo function
**/
//servo initialization
void key_init();
//读取机械按键
uint8_t key_read();
//读取电容按键
uint8_t key_read_touch();

/**
 **dht11 function
**/
void dht11_init();
float dht11_humidity();
float dht11_temperature();

/**
 **rain check function
**/
//rain check initialization
void rain_init();
int16_t rain_read_ao();
int8_t rain_read_do();
/**
 **fire check function
**/
//fire check initialization
void fire_init();
int16_t fire_read_ao();
int8_t fire_read_do();
/**
 **smog check function
**/
//smog check initialization
void smog_init();
int16_t smog_read_ao();
int8_t smog_read_do();

/**
 **sound check function
**/
//sound check initialization
void sound_init();
int16_t sound_read_ao();
int8_t sound_read_do();
/**
 **body check function
**/
//body check initialization
void body_init();
int8_t body_read();

#endif
